package datastream.api.operator.one.source.user;

import org.apache.flink.streaming.api.functions.source.SourceFunction;
import datastream.api.operator.one.pojo.user.InputModel;

public class UserSource implements SourceFunction<InputModel> {

    @Override
    public void run(SourceContext<InputModel> ctx) throws Exception {
        ctx.collect(InputModel.builder()
                .username("张三")
                .age(13)
                .build());
        Thread.sleep(1000);

        ctx.collect(InputModel.builder()
                .username("李四")
                .age(36)
                .build());
        Thread.sleep(1000);

        ctx.collect(InputModel.builder()
                .username("王五")
                .age(63)
                .build());
    }

    @Override
    public void cancel() {

    }
}